/*
 * AddFileWindow.java
 *
 * Created on __DATE__, __TIME__
 */

package com.kylinhunter.ch.plugin.knowledgebase.ui;

import javax.swing.JOptionPane;
 
import com.kylinhunter.ch.language.ResourceManager;
import com.kylinhunter.exception.KHException; 
import com.kylinhunter.ui.common.CHDeskTopFrame;
import com.kylinhunter.ui.common.DeskTopPanelInternalFrame;
import com.kylinhunter.ui.common.ResourceManagerAware;
import com.kylinhunter.ui.common.action.ExcueteAction;

/**
 *
 * @author  __USER__
 */
@CHDeskTopFrame(removeLangChangeListener = true,close_dispose=true)
public class AddFileWindow extends DeskTopPanelInternalFrame  {
	private AddFileWindowAction addFileWindowAction = null;
	

	public AddFileWindow(String windows_id, String title) {
		super(title, true, true, true, true);
		// TODO Auto-generated constructor stub
		initComponents();
		this.setWindows_id(windows_id);

	}

	/** Creates new form AddFileWindow */
	public AddFileWindow() {
		initComponents();

	}

	 

	/** This method is called from within the constructor to
	 * initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
	//GEN-BEGIN:initComponents
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		northPanel = new javax.swing.JPanel();
		bottomPane = new javax.swing.JPanel();
		saveButton = new javax.swing.JButton();
		scrollPane = new javax.swing.JScrollPane();
		editorPane = new javax.swing.JEditorPane();

		northPanel.setLayout(new javax.swing.BoxLayout(northPanel,
				javax.swing.BoxLayout.LINE_AXIS));
		getContentPane().add(northPanel, java.awt.BorderLayout.NORTH);

		saveButton.setText(" save");
		saveButton.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				saveButtonActionPerformed(evt);
			}
		});
		bottomPane.add(saveButton);

		getContentPane().add(bottomPane, java.awt.BorderLayout.PAGE_END);

		scrollPane.setViewportView(editorPane);

		getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);

		pack();
	}// </editor-fold>
	//GEN-END:initComponents

	private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
 
	
	    	ExcueteAction.execute(addFileWindowAction,this, addFileWindowAction.Action_AddFile);
		
			 
	}

	//GEN-BEGIN:variables
	// Variables declaration - do not modify
	private javax.swing.JPanel bottomPane;
	private javax.swing.JEditorPane editorPane;
	private javax.swing.JPanel northPanel;
	private javax.swing.JButton saveButton;
	private javax.swing.JScrollPane scrollPane;

	// End of variables declaration//GEN-END:variables

	 

	public javax.swing.JEditorPane getEditorPane() {
		return editorPane;
	}

	public AddFileWindowAction getAddFileWindowAction() {
		return addFileWindowAction;
	}

	public void setAddFileWindowAction(AddFileWindowAction addFileWindowAction) {
		this.addFileWindowAction = addFileWindowAction;
	}

	public void setEditorPane(javax.swing.JEditorPane editorPane) {
		this.editorPane = editorPane;
	}

	 

	@Override
	public void updateResource(ResourceManager resourceManager) {
		// TODO Auto-generated method stub

		 this.saveButton.setText(resourceManager.getString(KownledgeBasePlugin.RESOURCE, "AddFileWindow.saveButton"));

	}

	@Override
	public void chInit() {
		// TODO Auto-generated method stub
		  
			   ExcueteAction.execute(addFileWindowAction,this, addFileWindowAction.Action_Init);
			 
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		// TODO Auto-generated method stub
		
	}

	

}